package com.zelin.advice;

import org.aspectj.lang.ProceedingJoinPoint;

public class MyAdvice {
    public void before(){
        System.out.println("前置通知");
    }
    public void afterReturning(){
        System.out.println("后置通知，出现异常时不调用");
    }
    public Object around(ProceedingJoinPoint pjp)throws Throwable{
        System.out.println("环绕通知-前面代码");
        Object proceed = pjp.proceed();
        System.out.println("环绕通知-后面代码");
        return  proceed;
    }
    public void afterThrowing() {
        System.out.println("出异常了【后置通知】");
    }
    public void after(){
        System.out.println("无论是否出现异常，都会调用！【后置通知】");
    }
}
